using System;
using System.ComponentModel.DataAnnotations;
using WalkingTec.Mvvm.Core;

namespace HengTong.Model.Db.System;

/// <summary>
/// 系统通知消息实体类
/// 用于管理和跟踪各种业务流程中的通知消息
/// </summary>
/// <remarks>
/// 该类继承自TopBasePoco，包含了完整的通知消息信息，
/// 包括基本信息、接收人信息、状态信息和时间信息等
/// </remarks>
public class SysNotification : TopBasePoco
{
    /// <summary>
    /// 获取或设置通知消息的标题
    /// </summary>
    /// <value>通知消息的标题，不能为空，最大长度256字符</value>
    [Display(Name = "标题", Description = "通知消息的标题", GroupName = "基本信息")]
    [Required(ErrorMessage = "标题不能为空")]
    [MaxLength(512)]
    public string Title { get; set; }

    /// <summary>
    /// 获取或设置通知消息的内容
    /// </summary>
    /// <value>通知消息的详细内容，最大长度4000字符</value>
    [Display(Name = "内容", Description = "通知消息的详细内容", GroupName = "基本信息")]
    [MaxLength(4000)]
    public string Content { get; set; }

    /// <summary>
    /// 处理该待办的页面路由
    /// </summary>
    /// <value>处理该待办事项的页面路由地址，最大长度512字符</value>
    [Display(Name = "路由", Description = "处理该待办的页面路由", GroupName = "基本信息")]
    public SysBillRoute Route { get; set; }
    
    /// <summary>
    /// 处理该待办的页面路由路由 ID
    /// </summary>
    [Display(Name = "路由ID", Description = "处理该待办的页面路由ID", GroupName = "基本信息")]
    public Guid? RouteId { get; set; }
    
    /// <summary>
    /// 获取或设置通知分类ID
    /// </summary>
    /// <value>关联的通知分类的唯一标识</value>
    [Display(Name = "通知分类", Description = "通知消息的分类", GroupName = "分类信息")]
    public Guid? CategoryId { get; set; }

    /// <summary>
    /// 获取或设置通知分类导航属性
    /// </summary>
    public SysNotificationCategory Category { get; set; }

    /// <summary>
    /// 获取或设置业务类型
    /// </summary>
    /// <value>通知消息所属的业务类型分类，最大长度64字符</value>
    [Display(Name = "业务类型", Description = "通知消息的业务类型", GroupName = "基本信息")]
    [MaxLength(64)]
    public string BusinessType { get; set; }

    /// <summary>
    /// 获取或设置业务数据ID
    /// </summary>
    /// <value>关联的具体业务数据的唯一标识，最大长度64字符</value>
    [Display(Name = "业务数据ID", Description = "关联的业务数据ID", GroupName = "基本信息")]
    [StringLength(64)]
    public string BusinessId { get; set; }
    
    /// <summary>
    /// 获取或设置发送人用户名
    /// </summary>
    /// <value>发送该通知消息的用户名，最大长度64字符</value>
    [Display(Name = "发送人", Description = "发送人的用户名", GroupName = "人员信息")]
    [MaxLength(64)]
    public string Sender { get; set; }
    
    /// <summary>
    /// 获取或设置接收人用户名
    /// </summary>
    /// <value>接收该通知消息的用户名，最大长度64字符</value>
    [Display(Name = "接收人", Description = "接收人的用户名", GroupName = "人员信息")]
    [MaxLength(64)]
    public string Receiver { get; set; }
    
    /// <summary>
    /// 获取或设置阅读状态
    /// </summary>
    /// <value>通知消息的阅读状态，使用NotificationStatusEnum枚举值</value>
    [Display(Name = "阅读状态", Description = "通知消息的阅读状态", GroupName = "状态信息")]
    public NotificationStatusEnum Status { get; set; } = NotificationStatusEnum.未读;

    /// <summary>
    /// 获取或设置优先级
    /// </summary>
    /// <value>通知消息的重要程度级别，使用PriorityEnum枚举值</value>
    [Display(Name = "优先级", Description = "通知消息的优先级", GroupName = "状态信息")]
    public PriorityEnum Priority { get; set; } = PriorityEnum.普通;

    /// <summary>
    /// 获取或设置是否置顶
    /// </summary>
    /// <value>是否将通知消息置顶显示</value>
    [Display(Name = "是否置顶", Description = "是否置顶显示", GroupName = "状态信息")]
    public bool IsTop { get; set; } = false;

    /// <summary>
    /// 获取或设置发送时间
    /// </summary>
    /// <value>通知消息的发送时间</value>
    [Display(Name = "发送时间", Description = "通知消息的发送时间", GroupName = "时间信息")]
    public DateTime SendTime { get; set; } = DateTime.Now;

    /// <summary>
    /// 获取或设置阅读时间
    /// </summary>
    /// <value>通知消息的阅读时间，可为空</value>
    [Display(Name = "阅读时间", Description = "通知消息的阅读时间", GroupName = "时间信息")]
    public DateTime? ReadTime { get; set; }
    
        
    [Display(Name = "单据编号", Description = "关联的业务单据编号")]
    [StringLength(128)]
    public string BillCode { get; set; }
}

/// <summary>
/// 通知阅读状态枚举
/// 定义通知消息的阅读状态
/// </summary>
public enum NotificationStatusEnum
{
    /// <summary>
    /// 未读状态 - 尚未阅读的通知
    /// </summary>
    [Display(Name = "未读")]
    未读 = 1,
    
    /// <summary>
    /// 已读状态 - 已经阅读的通知
    /// </summary>
    [Display(Name = "已读")]
    已读 = 2
}